package nl.infodation.emr.pricingservice.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="config")
public class Config implements Serializable{
	
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="name")
	private String name;
	
	@Column(name="value")
	private String value;

	public String getName() {
		return name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public void setValue(final String value) {
		this.value = value;
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		return 31 + ((name == null) ? 0 : name.hashCode());
	}

	/**
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(final Object obj) {
		boolean isEqual = true;
		if (this == obj) {
			isEqual = true;
		} else if (obj == null) {
			isEqual = false;
		} else if (!(obj instanceof Config)) {
			isEqual = false;
		}
		final Config other = (Config) obj;
		if (null == other) {
			isEqual = false;
		} else {
			if (name == null) {
				if (other.name != null) {
					isEqual = false;
				}
			} else if (!name.equals(other.name)) {
				isEqual = false;
			}
		}
		return isEqual;
	}

	/**
	 * Handy for debugging
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return String.format("Config [name=%s, value=%s]", name, value);
	}
}